﻿using UnityEngine;
using System.Collections;

public class move : MonoBehaviour {
	
	public int playermoving;
	
	public int playerspeed = 5; 
	public int playerrotate = 50;
	
	public int health = 20;
	public int points;
	// Use this for initialization
	void Start () {
		}
	
	// Update is called once per frame
	void Update () 
	{
	
		if(playermoving == 1)
		{
			if(Input.GetKey(KeyCode.W))
			{
				transform.Translate(Vector3.right*Time.deltaTime*playerspeed);	
			}
			if(Input.GetKey(KeyCode.S))
			{
				transform.Translate(Vector3.left*Time.deltaTime*playerspeed);	
			}
			if(Input.GetKey(KeyCode.A))
			{
				transform.Rotate(Vector3.down*Time.deltaTime*playerrotate);	
			}
			if(Input.GetKey(KeyCode.D))
			{
				transform.Rotate(Vector3.up*Time.deltaTime*playerrotate);	
			}
		}
		if(playermoving == 2)
		{
			if(Input.GetKey(KeyCode.UpArrow))
			{
				transform.Translate(Vector3.left*Time.deltaTime*playerspeed);	
			}
			if(Input.GetKey(KeyCode.DownArrow))
			{
				transform.Translate(Vector3.right*Time.deltaTime*playerspeed);	
			}
			if(Input.GetKey(KeyCode.LeftArrow))
			{
				transform.Rotate(Vector3.down*Time.deltaTime*playerrotate);	
			}
			if(Input.GetKey(KeyCode.RightArrow))
			{
				transform.Rotate(Vector3.up*Time.deltaTime*playerrotate);	
			}
		}
		
		PlayerPrefs.SetInt("points", points);
	}
	
}